#include "RenderTask.h"
#include "IRenderer.h"
#include "TaskManager.h"
#include "SceneGraph.h"

RenderTask::RenderTask()
{
}

bool RenderTask::Start()
{
	Renderer->Initialize();
	new SceneGraph();
	return true;
}

void RenderTask::Update()
{
	Renderer->getWindow()->Messages();
	if (Renderer->getWindow()->Quit())
	{
		m_canKill = true;
		TaskManager::getSingleton().KillAllTasks();
	}
	Renderer->ClearBuffer();
	
	SceneGraph::getSingleton().Enable();
	
	Renderer->SwapBuffer();
}

void RenderTask::Stop()
{
	delete SceneGraph::getSingletonPtr();
	Renderer->Deinitialize();
}